/**
 * 当一个集合等的容器无法容纳更多元素时，就需要抛出此异常。
 *
 * @version 1.0
 * @exception
 */
export default class FullCapacityException extends Error {

  /**
   * @param className 容量已经满了的类名
   * @param capacity 此类当前容量
   */
  public constructor(className: string, capacity?: number) {
    if (capacity !== undefined) {
      super("this " + className + " is full of element, because its capacity is " + capacity);
    } else {
      super(className);
    }
  }
}